<template>
	<view class="content">
		<!--账单详细-->
		<view class="content_2">
			<block v-for="(data, index) in orderList" :key='index'>
				<view class="order_view">
					<view class="line_2"></view>
					<view class="order_box">
						<view class="detail_name">购买时间</view>
						<view class="detail">{{data.time}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">小区名字</view>
						<view class="detail">{{data.house_name}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">小区地址</view>
						<view class="detail">{{data.house_address}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">单元</view>
						<view class="detail">{{data.unit_text}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">楼层</view>
						<view class="detail">{{data.floor_text}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">有无电梯</view>
						<view class="detail">{{data.elevator_text}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">租客姓名</view>
						<view class="detail">{{data.customer_name}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">租客电话</view>
						<view class="detail">{{data.customer_phone}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">租期</view>
						<view class="detail">{{data.rentTime}}</view>
					</view>
					<view class="order_box">
						<view class="detail_name">备注</view>
						<view class="detail">{{data.text}}</view>
					</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	import {Request} from '../../../../utils/request.js';
	const app = getApp();
	export default {
		data() {
			return {
				choosetab: '1',
				orderList: [],
				//排序状态
				sortstate: '0',
			}
		},
		methods: {
			show:function(id){
				//获取发布信息列表
				new Request('customer/push/Get_Pushinfo/Detail').request(
					()=>{
						return 'POST'
					},
					()=>{
						return {
							openid: app.globalData.openid,
							push_id: id
						}
					},
					(res)=>{
						if(res.data.code == 0){
							new Request().showToast(res.data.msg);
							return;
						}
						if (res.data.code == 1) {
							this.orderList = [];
							this.orderList.push(res.data.data);
							this.orderList = this.orderList.map((item, index) =>{
								return {
									id: item.id,
									time: item.paytime,
									order_sn: item.createtime,
									text: item.text == '' ? '无' : item.text,
									customer_name: item.user_name,
									customer_phone: item.user_phone,
									rentMoney: item.rent_money_start + '-' + item.rent_money_end,
									//租期
									rentTime: item.rentTime, 
									unit_text: item.unit_text == '' ? '无' : item.unit_text,
									floor_text: item.floor_text == '' ? '无' : item.floor_text,
									elevator_text: item.elevator_text,
									//小区名称
									house_name: item.house_name,
									longitude: item.longitude,
									latitude: item.latitude,
									house_address: item.house_address,
									//支付金额
									money: item.money,
								}
							})
							console.log(this.orderList)
						}
					}
				)
			}
		},
		onLoad(option) {
			let push_id = option.push_id;
			this.show(push_id);
		}
	}
</script>

<style>
	page {
		background-color: #F9F9F9;
	}

	.content {
		padding-bottom: 190upx;
	}

	/*
		顶部标签样式
	*/
	.content_1 {
		margin-top: 40upx;
		padding-left: 40upx;
	}

	.tab_view {
		height: 40upx;
		display: flex;
		align-items: center;
	}

	.tab_box {
		height: 40upx;
		display: flex;
		align-items: center;
		margin-right: 80upx;
	}

	.tab_name {
		height: 40upx;
		line-height: 40upx;
		font-size: 28upx;
		color: #B3E9DC;
		margin-right: 10upx;
	}

	.tab_name_none {
		height: 40upx;
		line-height: 40upx;
		font-size: 28upx;
		color: #666666;
		margin-right: 10upx;
	}

	.tab_icon {
		height: 28upx;
		width: 28upx;
	}

	/**
	 * 账单详细样式
	 */

	.order_view {
		margin-top: 30upx;
		display: flex;
		flex-direction: column;
	}

	.line_2 {
		height: 20upx;
		background-color: #FFFFFF;
		margin-bottom: 20upx;
	}

	.order_box {
		height: 80upx;
		padding: 0upx 40upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.detail_name {
		height: 80upx;
		line-height: 80upx;
		font-size: 28upx;
		color: #999999;
	}

	.detail {
		height: 80upx;
		line-height: 80upx;
		font-size: 28upx;
		color: #999999;
	}
	/* 操作按钮 */
	.operate_button{
		display: flex;
		justify-content: flex-end;
		font-size: 28upx;
		padding: 0upx 40upx;
	}
	.operate_edit{
		color: orange;
		margin: 10upx;
	}
	.operate_del{
		color: red;
		margin: 10upx 0 10upx 10upx;
	}
</style>
